package com.lyf.viewapp.picture;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.lyf.viewapp.R;
import com.lyf.viewapp.base.BaseActivity;
import com.lyf.viewapp.picture.pictureselector.SimpleActivity;
import com.lyf.viewapp.picture.show.ImageShowMainActivity;
import com.lyf.viewapp.picture.takephoto.MainActivity;
import com.lyf.viewapp.util.EnterAdapter;
import com.lyf.viewapp.util.EnterBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 照片选择处理等
 * @author lyf
 */
public class PictureMainActivity extends BaseActivity {

    @BindView(R.id.picture_listView)
    ListView listView;

    private List<EnterBean> list;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_picture_main);
        ButterKnife.bind(this);

        list = new ArrayList<>();
        initDate();

    }

    private void initDate() {
        list.add(new EnterBean("PictureSelect", SimpleActivity.class));
        list.add(new EnterBean("TakePhoto", MainActivity.class));
        list.add(new EnterBean("ImageShow", ImageShowMainActivity.class));

        EnterAdapter ada = new EnterAdapter(this, list);
        listView.setAdapter(ada);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = new Intent(PictureMainActivity.this, list.get(position).getActivity());
                startActivity(intent);
            }
        });
    }
}
